home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / comm2 / ums116bt.lha / UMS / rexx / UMSEdit.rexx < prev    next >
OS/2 REXX Batch file  |  1994-12-21  |  1KB  |  45 lines

  1. /* safely edit the UMS configuration-file */
  2.  
  3. /*** Init ***/
  4.  
  5. call addlib("rexxdossupport.library", 0, -30)
  6. call addlib("ums.library", 0, -210, 11)
  7. call UMSInitConsts()
  8.  
  9. /*** Arguments ***/
  10.  
  11. ProgramName = "UMSEdit";
  12. ArgsTemplate = "SERVER"
  13. args.SERVER = "default"
  14.  
  15. parse arg arguments
  16. if strip(arguments) = '?' then do
  17.   call writech(STDOUT, ArgsTemplate || ': ')
  18.   arguments = readln(STDIN)
  19. end; else nop
  20. if ~ReadArgs(arguments,ArgsTemplate,"args.") then do
  21.   say Fault(RC, ProgramName)
  22.   exit 10
  23. end; else nop
  24.  
  25. /*** look for server and dir ***/
  26.  
  27. dir = GetVar('umsmb.' || args.server)
  28. if dir = "" then do
  29.   say "UMS-MB '" || args.server || "' does not exist"
  30. end; else do
  31.   call pragma("D", dir)
  32.  
  33.   /* try to lock the config */
  34.   res = UMSServerControl("LOCKCFG", args.server)
  35.   if res = 0 then do
  36.     say "editing config for MB '" || args.server || "' in" dir
  37.     address command "$EDITOR ums.config"
  38.  
  39.     /* release the lock */
  40.     call UMSServerControl("UNLOCKCFG", args.server)
  41.   end; else do
  42.     say "UMS Error #" || res || ": " || UMSErrTxtFromNum(res)
  43.   end
  44. end
  45.